{extend name="public/best"/}
{block name="title"}
{:lang('Registered')}
{/block}
{block name="main"}
<div class="login-main">
    <div class="layui-elip">{:lang('Registered')}</div>
    <form class="layui-form" action="{:url('register')}">
        {:token()}
        {:hook('register_input')}
        <input type="hidden" name="site_id" value="{$siteId}" />
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-cellphone"></label>
                <input type="text" name="mobile" lay-verify="phone|required" autocomplete="off" placeholder="{:lang('phone')}" class="layui-input">
            </div>
        </div>
        {eq name="Member_config.register_mobile_verify" value="1"}
        <div class="layui-form-item">
            <div class="layui-input-inline" style="width: 60%;">
                <label class="layui-icon layui-icon-cellphone"></label>
                <input type="text" name="captcha_mobile" required="" lay-verify="required" autocomplete="off" value="" class="layui-input" placeholder="{:lang('PhoneVerificationCode')}"> </div>
            <button class="layui-btn btn-captcha layui-btn-primary" type="button" data-event="register" data-type="mobile" data-url="{:url('api/sms/send')}">{:lang('GetVerificationCode')}</button>
        </div>
        {/eq}
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-username"></label>
                <input type="text" name="username" lay-verify="required" autocomplete="off" placeholder="{:lang('Account')}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-email"></label>
                <input type="text" name="email" lay-verify="email|required" autocomplete="off" placeholder="{:lang('email')}" class="layui-input">
            </div>
        </div>
        {eq name="Member_config.register_email_verify" value="1"}
        <div class="layui-form-item">
            <div class="layui-input-inline" style="width: 60%;">
                <label class="layui-icon layui-icon-vercode"></label>
                <input type="text" name="captcha_email" required="" lay-verify="required" autocomplete="off" value="" class="layui-input" placeholder="{:lang('EmailVerificationCode')}"> </div>
            <button class="layui-btn btn-captcha layui-btn-primary" type="button" data-event="register" data-type="email" data-url="{:url('api/ems/send')}">{:lang('GetVerificationCode')}</button>
        </div>
        {/eq}
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-password"></label>
                <input type="password" name="password" lay-verify="required" autocomplete="off" placeholder="{:lang('Password')}" class="layui-input">
            </div>
        </div>
        {eq name="Member_config.password_confirm" value="1"}
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-password"></label>
                <input type="password" name="password_confirm" lay-verify="required" autocomplete="off" placeholder="{:lang('ConfirmPassword')}" class="layui-input">
            </div>
        </div>
        {/eq}
        {eq name="Member_config.remove_nickname" value="0"}
        <div class="layui-form-item">
            <div class="layui-input-inline input-item">
                <label class="layui-icon layui-icon-username"></label>
                <input type="text" name="nickname" lay-verify="required" autocomplete="off" placeholder="{:lang('nickname')}" class="layui-input">
            </div>
        </div>
        {/eq}
        <div class="layui-form-item">
            <div class="layui-input-inline input-item verify-box">
                <label class="layui-icon layui-icon-vercode"></label>
                <input type="text" name="verify" lay-verify="required" placeholder="{:lang('captcha')}" autocomplete="off" class="layui-input">
                <img id="verify" src="{:captcha_src()}" alt="验证码" class="captcha">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline login-btn">
                <button class="layui-btn layui-btn-danger" lay-submit>{:lang('register')}</button>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                {:lang('HaveAccount')}！<a href="{:url('login')}" class="layadmin-user-jump-change layadmin-link">{:lang('login')}</a>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="js"}
    <script type="text/javascript">
    layui.use(['form', 'layer','yznForm'], function() {
        var form = layui.form,
            layer = layui.layer,
            yznForm = layui.yznForm;

            yznForm.listen('', function (res) {
                layer.msg(res.msg, {
                    offset: '15px',
                    icon: 1,
                    time: 1000
                }, function() {
                    window.location.href = res.url;
                });
                return false;
            }, function (res) {
                //刷新验证码
                $("#verify").click();
                //layer.msg(res.msg, { icon: 5 });
            });
    });
    //刷新验证码
    $("#verify").click(function() {
        var verifyimg = $("#verify").attr("src");
        $("#verify").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
    });
    </script>
{/block}